<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title></title>
<%@ include file="/WEB-INF/views/include/easyui.jsp"%>
</head>
<body>
	<div>
		<form id="mainform" action="${ctx}/verinfo/${action}" method="post"
			enctype="multipart/form-data">
			<input type="hidden" name="id" value="${vi.id }" />
			<table class="formTable"
				style="border-collapse: separate; border-spacing: 10px;">
				<tr>
					<td>操作系统：</td>
					<td>
						<select id="os" class="easyui-combobox" name="os"
								data-options="required:'required'">
							<option value=""></option>
							<option value="iOS" ${vi.os=='iOS'?'selected':''}>iOS</option>
							<option value="android" ${vi.os=='android'?'selected':''}>android</option>
						</select>	
					</td>
				</tr>
				<tr>
					<td>App名称：</td>
					<td><select id="appname" class="easyui-combobox" name="appname"
								data-options="required:'required'">
							<option value=""></option>
							<option value="0" ${vi.appname=='0'?'selected':''}>B端</option>
							<option value="1" ${vi.appname=='1'?'selected':''}>C端</option>
					</select></td>
				</tr>
				<tr id="appTypeRow" style="display:none">
					<td>App类型：</td>
					<td><select id="appType" class="easyui-combobox" name="appType"
								data-options="required:'required'">
							<option value="0" ${vi.appType=='0'?'selected':''}>线下扫码版</option>
							<option value="1" ${vi.appType=='1'?'selected':''}>AppStore版</option>
					</select></td>
				</tr>
				<tr>
					<td>版本号：</td>
					<td><input id="version" name="version" type="text"
						value="${vi.version }" class="easyui-validatebox"
						data-options="width: 200,required:'required'" /></td>
				</tr>
				<tr>
					<td>更新类型：</td>
					<td><select id="updatestatus" class="easyui-combobox" name="updatestatus"
								data-options="required:'required'">
							<option value=""></option>
							<option value="0" ${vi.updatestatus=='0'?'selected':''}>不强制更新</option>
							<option value="1" ${vi.updatestatus=='1'?'selected':''}>强制更新</option>
					</select></td>
				</tr>
				<tr>
					<td>下载地址：</td>
					<td><input id="appurl" name="appurl" type="text"
						value="${vi.appurl }" class="easyui-validatebox"
						data-options="width: 200" /></td>
				</tr>
			</table>
		</form>
	</div>
	<script type="text/javascript">
		$('#os').combobox({
			width : 200,
			panelHeight : 100
		});
		$('#appname').combobox({
			width : 200,
			panelHeight : 100
		});
		$('#appType').combobox({
			width : 200,
			panelHeight : 100
		});
		$('#updatestatus').combobox({
			width : 200,
			panelHeight : 100
		});
		var action = "${action}";
		
		if(action=='update'){
			if('${vi.os}' == 'iOS') {
				$('#appTypeRow').show();
			}
		}
		

		$('#mainform').form({
			onSubmit : function() {
				var isValid = $(this).form('validate');
				return isValid; // 返回false终止表单提交
			},
			success : function(data) {
				successTip(data, dg, d);
			}
		});
		
		$('#os').combobox({
			onChange: function (n, o) {
				if(n == 'iOS') {
					if($('#appTypeRow').is(":hidden")) {
						$('#appTypeRow').show();
					}
				} else {
					if(!$('#appTypeRow').is(":hidden")) {
						$('#appTypeRow').hide();
						$("#appType").combobox('setValue', '0');
					}
					
				}
			}
		});
		
	</script>
</body>
</html>